package com.example.app.retrofit3.api;

import android.content.Context;

import com.example.app.retrofit.api.GetApi;
import com.example.app.retrofit3.bean.UpdatePwdResultBean;
import com.example.app.retrofit3.bean.UpdatePwdSendBean;

import java.util.Map;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class ApiClient3 {
    private Retrofit mRetrofit;
    private Api3 mApi;
    private static ApiClient3 sApiClient;
    private ApiClient3(final Context context){
        mRetrofit = new Retrofit.Builder().baseUrl(GetApi.baseURL).
                addConverterFactory(GsonConverterFactory.create()).build();
        mApi = mRetrofit.create(Api3.class);
    }
    public static ApiClient3 getInstance(Context context){
        if (sApiClient == null){
            sApiClient = new ApiClient3(context);
        }
        return sApiClient;
    }
    public static void destoryInstance(){
        if (sApiClient != null){
            sApiClient = null;
        }
    }
    public String getRootURL()
    {
        return GetApi.baseURL;
    }

    public Call<UpdatePwdResultBean> getReturnData(Map<String ,String> map, UpdatePwdSendBean updatePwdSendBean){
        return mApi.resetPwd(map,updatePwdSendBean);
    }
}
